﻿using System;
using System.IO;

namespace LabSolutions
{
    struct Point
    {
        public Point(double x, double y)
        {
            X = x;
            Y = y;
        }
        public double X;
        public double Y;
    }

    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
           
            string[] inputNumbers = input.Split(' ');
            double x = double.Parse(input);
            double value =
                x > Math.PI ? Line(new Point(Math.PI, 0), new Point(Math.PI + 1, 1), x)  :
                x > 0 ? Math.Sin(x) :
                x > -4 ? Line(new Point(-4d, 2d), new Point(0d, 0d), x) :
                x > -5 ? 2 :
                x >= -9 ? Circle(new Point(-7d, 2d), 2, x, false) : 
                double.NaN;
            
            Console.Write(value.ToString("0.00000"));                  
        }

        private static double Circle(Point center, double radius, double x, bool higher)
        {
            return center.Y + (higher ? 1 : -1) * Math.Sqrt(Math.Pow(radius, 2) - Math.Pow(x - center.X, 2));
        }

        private static double Line(Point point1, Point point2, double x)
        {
            return point1.Y + (point2.Y - point1.Y) * (x - point1.X) / (point2.X - point1.X);
        }
    }
}
